1. Field of the Invention
The present invention relates to Class D electronic amplifiers, and in particular, to a pulse width modulator with over-voltage modulation and automatic gain control.
2. Discussion of the Related Art
In a class D audio amplifier, a pulse width modulator is used to convert an incoming analog signal into a digital signal for improved transmission integrity. This digital signal is later converted back to an analog signal by an LC filter in order to drive an output speaker. A block diagram of this sequence is shown in FIG. 1. An analog signal A.sub.-- SIG is received by an amplifier 112, which applies a desired amount of gain to signal A.sub.-- SIG to generate a signal AMP.sub.-- OUT. Meanwhile, an oscillator circuit 102 provides a binary clocking signal CK to a triangle wave generator 103, which generates a triangle wave voltage signal T.sub.-- WAVE that oscillates between high inflection points at an upper voltage potential Vupper and low inflection points at a lower voltage potential Vlower. FIG. 5a depicts signal CK, while FIG. 5b shows signal T.sub.-- WAVE, over which signal AMP.sub.-- OUT has been superimposed. A comparator circuit 106 compares signal T.sub.-- WAVE and signal AMP.sub.-- OUT, and generates an output at a voltage potential Vhigh when signal AMP.sub.-- OUT is larger than signal T.sub.-- WAVE, and generates an output at a voltage potential Vlow when the reverse is true. This produces a digital output pulse signal P.sub.-- OUT, as shown in FIG. 5c. Although signal P.sub.-- OUT has pulse widths proportional to the magnitude of analog signal AMP.sub.-- OUT, it cannot be sent directly to an LC filter 113. As can be seen in FIG. 5c, signal P.sub.-- OUT is made up of a series of pulses between voltage potentials Vlo and Vhi, with a low-going pulse roughly centered around each high inflection point of signal T.sub.-- WAVE, and a high-going pulse roughly centered around each low inflection point of signal T.sub.-- WAVE. However, if signal AMP.sub.-- OUT goes outside the bounds defined by voltage potentials Vupper and Vlower, signal P.sub.-- OUT becomes fixed in a single output state. For example, if signal AMP.sub.-- OUT becomes greater than voltage potential Vupper, as shown in the right portion of FIG. 5b, signal P.sub.-- OUT becomes pegged at voltage potential Vhi, as shown by the corresponding portion of FIG. 5c. Likewise, if signal AMP.sub.-- OUT drops below voltage potential Vlower, signal P.sub.-- OUT falls to a constant voltage Vlo. In either case, the unchanging signal P OUT would quickly saturate the inductor coil of LC filter 113, leading to overheating and possible permanent damage. Therefore a typical PWM includes a pulse generator circuit 115 that provides a rapid discharge pulse to ensure that the inductor coil of the LC filter is given a chance to discharge even if signal P.sub.-- OUT does not change state. As shown in FIG. 1, a conventional embodiment of pulse generator 105 includes a signal generator 104 which produces an output voltage Vlimit.sub.-- hi that is typically 90-95% of voltage Vupper, and a signal generator 105 produces an output voltage Vlimit.sub.-- lo that is typically 5-10% greater than voltage Vlower. Voltages Vlimit.sub.-- hi and Vlimit.sub.-- lo are compared to signal T.sub.-- WAVE by comparators 107 and 108, respectively, in order to generate short discharge pulses about every high or low inflection point of signal T.sub.-- WAVE. As shown in FIG. 5e, comparator 107 produces a low-going pulse signal PULSE.sub.-- LO, while comparator 108 produces a high-going pulse signal PULSE.sub.-- HI. A safety discharge circuit 116 made up of AND gates 109 and 110 and OR gate 111 combine the pulses of PULSE.sub.-- HI and PULSE.sub.-- LO with signal P.sub.-- OUT, thereby ensuring that signal D.sub.-- OUT does not continuously remain at a single voltage potential. FIG. 5d shows how the example signal P.sub.-- OUT shown in FIG. 5c is modified by signal PULSE.sub.-- LO to produce varying output signal D.sub.-- OUT.
This method of output regulation to prevent invariant output signals has two major problems. The first derives from the use of triangle wave signal T.sub.-- WAVE as the reference for pulse signals PULSE.sub.-- HI and PULSE.sub.-- LO. If signal T.sub.-- WAVE is precise and consistent, pulse signals PULSE.sub.-- HI and PULSE.sub.-- LO will be properly generated as shown in FIG. 7a. However, the inflection points of a triangular wave will generally not be sharp transitions. As shown in FIG. 7b, fluctuations at the inflection point can cause multiple triggering, which can lead to output signal distortion or even LC filter failure due to reduced discharge time. Substantial noise can even lead to a no-triggering situation, as shown in FIG. 7c. In either case, the lack of precise triangular waveform can limit the effectiveness of pulse generator circuit 115.
The other problem is the fact that even if pulse generator circuit 115 is functioning properly, if signal AMP.sub.-- OUT remains outside the band between voltages Vlower and Vupper, or "overmodulated", signal D.sub.-- OUT will stay at maximum output. Not only does this situation prevent the transmission of any useful signal information, but it will eventually lead to system damage if permitted to continue unabated.
Accordingly, it is desirable to provide a PWM circuit that ensures proper discharge pulse creation and also deals with long-term overmodulated input signals.